#include <stc8h.h>
#include "uart.h"

void Uart2_Init(void) { //115200bps@33.1776MHz
	S2CON = 0x50;		//8位数据,可变波特率
	AUXR |= 0x04;		//定时器时钟1T模式
	T2L = 0xB8;			//设置定时初始值
	T2H = 0xFF;			//设置定时初始值
	AUXR |= 0x10;		//定时器2开始计时
}

char putchar(char c) {   /* character to output */
    S2BUF = c;
    while (!(S2CON & 0x02));
    S2CON &= ~0x02;
    return c;
}
